// Queue Demo
// Created by FanGccU on 2025/6/22.
// 先进先出


#include <iostream>
#include <queue>
using namespace std;

void func() {
    queue<int> q;

    // 向尾部添加元素
    q.push(1);
    q.push(2);
    q.push(3);

    cout << "first value is ：\t" << q.front() << endl;
    cout << "last value is ：\t" << q.back() << endl;

    if (q.empty()) {
        cerr << "q value is null!" << endl;
        return;
    }
    // 移除头部的元素
    q.pop();

    cout << endl;
    cout << "first value is ：\t" << q.front() << endl;
    cout << "last value is ：\t" << q.back() << endl;
}

int main(int argc, char *argv[]) {
    func();
}
